<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>
<style>

</style>

<body>
    <div id="box">
        <input type="text" v-model="firstName"><br>
        <input type="text" v-model="lastName"><br>
        <input type="text" v-model="fullName()"><br>
        <input type="text" v-model="fullName1"><br>
    </div>
    <script>
        const vm = new Vue({
            el: '#box',
            data: {
                firstName: 'a',
                lastName: 'b',
            },
            methods: {
                fullName() {
                    return this.firstName + '-' + this.lastName;
                }
            },
    
            computed: {
                fullName1: {
                    get() {
                        return this.firstName + '-' + this.lastName
                    },
                    set(value) {
                        const arr = value.split('-');
                        this.firstName = arr[0];
                        this.lastName = arr[1]
                    }
                }
            }

        })
        console.log(vm);
    </script>
</body>

</html>